package com.miaoquan.mqportal.feign.hystrix;

import com.miaoquan.mqcommon.api.CommonPage;
import com.miaoquan.mqcommon.api.CommonResult;
import com.miaoquan.mqcommon.api.ResultCode;
import com.miaoquan.mqcommon.exception.ApiException;
import com.miaoquan.mqmbg.model.TbkProduct;
import com.miaoquan.mqportal.feign.SearchFeign;
import com.taobao.api.request.TbkDgMaterialOptionalRequest;
import org.springframework.stereotype.Component;

/**
 * 容错处理类，当调用失败时，简单返回空字符串 *
 *
 * @author Fa
 * @date 2020-04-03 22:45
 */
@Component
public class SearchFeignFallback implements SearchFeign {

    @Override
    public CommonResult<CommonPage<TbkProduct>> searchProduct(Long pageNum, boolean isTmall, String q) throws ApiException {
        return CommonResult.failed(ResultCode.HYSTRIX_FALLBACK, "调用服务mq-api-tbk服务失败");
    }

    @Override
    public CommonResult<CommonPage<TbkProduct>> searchProduct(TbkDgMaterialOptionalRequest tbkDgMaterialOptionalRequest) throws ApiException {
        return CommonResult.failed(ResultCode.HYSTRIX_FALLBACK, "调用服务mq-api-tbk服务失败");
    }
}

